#include"RoomStd.h"

const  vector<RoomState>RoomStd_StateQueue={
    RoomState::Start,

    RoomState::Ban,
    RoomState::Ban,
    RoomState::Pick,
    RoomState::Pick,
    RoomState::Pick,
    RoomState::Pick,
    RoomState::AssignPF,
    RoomState::RoundOver,

    RoomState::Ban,
    RoomState::Ban,
    RoomState::Pick,
    RoomState::Pick,
    RoomState::Pick,
    RoomState::Pick,
    RoomState::AssignPF,
    RoomState::RoundOver,
};

const vector<int>RoomStd_OpTeamIndex={
    -1,
    0,1,0,1,1,0,-1,-1,
    1,0,1,0,0,1,-1,-1
};

vector<RoomState> RoomStd::getOriginalStateQueue()const {
    return RoomStd_StateQueue; // Return the state queue for the room
}
vector<int>RoomStd::getOriginalStateOpTeamIndex()const{
    return RoomStd_OpTeamIndex;
}

// Ban a profession for a team in a specific round
int RoomStd::BanProfession(int round_number, int teamID, int PF_ID) {
    return pfLists[round_number].BanProfession(teamID,PF_ID);
}

// Pick a profession for a team in a specific round
int RoomStd::PickProfession(int round_number, int teamID, int PF_ID) {
    return pfLists[round_number].PickProfession(teamID,PF_ID);
}

// Assign professions for a team (批量分配)
int RoomStd::AssingProfession(int round_number,int teamID, std::vector<int> PF_IDs) {
    return pfLists[round_number].AssignProfessions(teamID,PF_IDs);
}


int RoomStd::AddTeam(int teamID){
    if(teamIDs.size()>=RoomStd::TEAM_REQUIREMENT){
        return 1;
    }
    for(auto tid:teamIDs){
        if(tid==teamID)return 2;
    }

    teamIDs.push_back(teamID);
    if(teamIDs.size()==RoomStd::TEAM_REQUIREMENT){
        stateManager->Start();
    }
    return 0;
}

int RoomStd::RemoveTeam(int teamID){

}